﻿using ContactSMS.Domain.Entity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace ContactSMS.Infrastructure.Configs
{
    public class UserConfig : IEntityTypeConfiguration<User>
    {
        public void Configure(EntityTypeBuilder<User> builder)
        {
            builder.ToTable($"T_{nameof(User)}", t => t.HasComment("用户表"));
            builder.HasKey(t => t.Id);
            builder.Property(t => t.Id).IsRequired().HasComment("用户id");
            builder.Property(t => t.UserName).HasColumnType("VARCHAR(30)").HasComment("用户名");
            builder.Property(t => t.PassWord).HasColumnType("VARCHAR(255)").HasComment("密码");
            builder.Property(t => t.Avatar).HasColumnType("VARCHAR(255)").HasComment("头像");
            builder.Property(t => t.Phone).HasColumnType("VARCHAR(80)").HasComment("手机号");
            builder.Property(t => t.Email).HasColumnType("VARCHAR(100)").HasComment("邮箱");
            builder.Property(t => t.CreatTime).HasComment("创建时间");
            builder.Property(t => t.UpdateTime).HasComment("更新时间");
        }
    }
}
